<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        img{
            width: 200px;
            height: 200px;
        }
    </style>
</head>
<body>
    <div>
        <img src="./images/900px-Partner_hikari_fracture.png" />
        <img src="./images/900px-Partner_hikari_zero.png" />
        <img src="./images/900px-Partner_hikari_fantasia.png" />


        <div style="margin-top: 700px;">
            <img src="./images/900px-Partner_tairitsu_grievous_lady.png" data-real="./images/900px-Partner_tairitsu_tempest.png" />  
        </div>
        
    </div>
</body>
<script>
    document.body.addEventListener('scroll',function(e) {
        let imgList = document.getElementsByClassName('lazy')
        for(let i=0;i<imgList.length;i++) {
            let imgTop = (document.body.scrollTop || document.documentElement.scrollTop)
            console.log(document.documentElement.scrollTop)
            if(imgList[i].offsetTop <= imgTop) {
                let imgSrc = imgList[i].getAttribute('data-src')
                imgList[i].setAttribute('src',imgSrc)
            }
        }
    })
</script>
</html>